home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-11
/
pdrd2.zip
/
RD.ZIP
/
RD_DEMO3.PRG
< prev
next >
Wrap
Text File
|
1993-01-11
|
3KB
|
89 lines
/*
RD_DEMO3.PRG
Demonstrates the following APIs:
1. ADr_popup() - pops up a picklist of valid Get values.
2. ADr_required() - disallows leaving an empty Get.
3. ADr_jump() - moves the focus to a specified Get.
4. ADr_blank() - blanks specific Gets.
5. ADr_keys() - defines hot keys.
*/
#include "read.ch"
#include "inkey.ch"
//---------
func main()
local aPayModes := { "Cash ",;
"Credit Card",;
"Check " }
local aCards := { "Visa ",;
"MasterCard",;
"Discover " }
local getlist[0]
local cPayMode := space(11)
local cCardType := space(10)
local cCardNumber := space(16)
local nAmount := 0
local nT := 10, nL := 10, nB := 15, nR := 42
local cColor := setcolor( if( iscolor(), "W+/BG, GR+/R,,, N/R", nil ) )
local aScn, aScn2
local bConfig := {|e| ADr_keys( e,;
{K_ALT_F1, K_F10},;
{|e,nth,nkey| Xkeys3(e,nth,nkey,aPayModes,aCards)};
);
}
cls
aScn = ADbox( nT, nL, nB, nR )
aScn2 = ADmessage( {;
"Popups are attached to 'Payment mode' and 'Card type'.",;
"Activate them by pressing ALT-F1 or by keying in an invalid",;
"entry.",;
"You may also press F10 to blank all Gets";
},;
18,, .f., .f.;
)
@nT+1, nL+2 say "Payment mode" adget cPayMode;
valid {|e,_x| _x := ADr_popup( e, row()+1, col()+3, aPayModes, {4,11,5} ),;
_x != 0 }
@nT+2, nL+2 say "Card type " adget cCardType;
valid {|e| ADr_popup( e, row()+1, col()+3, aCards ) > 0};
when ( cPayMode == "Credit Card" )
@nT+3, nL+2 say "Card number " adget cCardNumber;
valid {|e| ADr_required(e)};
when ( cPayMode == "Credit Card" )
@nT+4, nL+2 say "Amount " adget nAmount picture "99999.99"
ADread( getlist, bConfig )
ADrestscn( aScn2 )
ADrestscn( aScn )
setcolor( cColor )
return nil
//------------------------------------------
func Xkeys3( e, nth, nkey, aPayMode, aCards )
if nkey = K_ALT_F1
Xpopup3( e, aPayMode, aCards )
elseif nkey = K_F10
ADr_blank( e, {} )
ADr_jump( e, 1, .t. )
endif
return nil
//-------------------------------
func Xpopup3(e, aPayModes, aCards)
local nthGet := ADr_nthget(e)
if nthGet = 1
ADr_popup( e, row()+1, col()+3, aPayModes, {4,11,5}, .t. )
elseif nthGet = 2
ADr_popup( e, row()+1, col()+3, aCards,, .t. )
else
tone(100,1)
endif
return nil